package com.pubinfo.passbook.engine.chain.transfer;

import com.pubinfo.passbook.engine.chain.ComputeChain;
import lombok.Setter;

/**
 * 简单的计算链转化器, 当计算链类型和目标的计算单元的计算链类型一致, 也就是可以直接返回数据不需要特殊convert.
 * 就用这个直接生成
 *
 * @author zhouch
 * @date 2022/4/6 9:54
 */
public class SimpleTransfer<T, R> extends ComputeChainTransfer<T, T, R> {

    @Setter
    private String chainType;

    @Setter
    private String resultType;

    public SimpleTransfer(ComputeChain<T, R> computor, String chainType, String resultType) {
        super(computor);
        this.chainType = chainType;
        this.resultType = resultType;
    }

    @Override
    public String getChainType() {
        return chainType;
    }

    @Override
    public String getResultType() {
        return resultType;
    }

    @Override
    T convert(T data) {
        return data;
    }
}
